﻿CREATE PROCEDURE [dbo].[ExecSessionLogInsert]
(
	@BlockingSessionId			INT, 
	@CommandType				NVARCHAR(255), 
	@CpuTime					INT, 
	@DatabaseName				NVARCHAR(255), 
	@ExecutingStatement			NVARCHAR(MAX), 
	@HostName					NVARCHAR(50), 
	@LastModifiedDate			DATETIME, 
	@LastWaitType				NVARCHAR(255), 
	@LastWrite					DATETIME, 
	@LoginName					NVARCHAR(50), 
	@ObjectName					NVARCHAR(255), 
	@ProgramName				NVARCHAR(255), 
	@QueryPlan					XML, 
	@Reads						INT, 
	@InstanceName				NVARCHAR(255), 
	@SessionId					INT, 
	@SessionStatus				NVARCHAR(50), 
	@SessionLogSetId			UNIQUEIDENTIFIER, 
	@TransactionIsolationLevel	NVARCHAR(255), 
	@WaitResource				NVARCHAR(255), 
	@WaitTime					INT, 
	@WaitType					NVARCHAR(255),
	@Writes						INT
)
AS
BEGIN
INSERT INTO [dbo].[ExecSessionLog] (
					BlockingSessionId, 
					CommandType, 
					CpuTime, 
					DatabaseName, 
					ExecutingStatement, 
					HostName, 
					LastModifiedDate, 
					LastWaitType, 
					LastWrite, 
					LoginName, 
					ObjectName, 
					ProgramName, 
					QueryPlan, 
					Reads, 
					InstanceName, 
					SessionId, 
					SessionStatus, 
					SessionLogSetId, 
					TransactionIsolationLevel, 
					WaitResource, 
					WaitTime, 
					WaitType, 
					Writes 
) 
VALUES  
( 
					@BlockingSessionId, 
					@CommandType, 
					@CpuTime, 
					@DatabaseName, 
					@ExecutingStatement, 
					@HostName, 
					@LastModifiedDate, 
					@LastWaitType, 
					@LastWrite, 
					@LoginName, 
					@ObjectName, 
					@ProgramName, 
					@QueryPlan, 
					@Reads, 
					@InstanceName, 
					@SessionId, 
					@SessionStatus, 
					@SessionLogSetId, 
					@TransactionIsolationLevel, 
					@WaitResource, 
					@WaitTime, 
					@WaitType, 
					@Writes 
);
RETURN 0
END